package xx.iverson.listening_manager.mapper;

import org.apache.ibatis.annotations.Mapper;
import xx.iverson.listening_manager.entity.CategoryLevel1;
import xx.iverson.listening_manager.entity.CategoryLevel2;

import java.util.List;

/**
 * xx.iverson.listening_manager.mapper.SysUserMapper
 * 描述：
 * on 2025/10/16-下午4:42
 *
 * @author weijx
 */
@Mapper
public interface CategoryMapper {
    // 一级分类操作
    List<CategoryLevel1> selectAllLevel1();

    CategoryLevel1 selectLevel1ById(Integer categoryId);

    int insertLevel1(CategoryLevel1 category);

    int updateLevel1(CategoryLevel1 category);

    int deleteLevel1(Integer categoryId);


    // 二级分类操作
    List<CategoryLevel2> selectAllLevel2();

    List<CategoryLevel2> selectLevel2ByCategoryId(Integer categoryId);

    CategoryLevel2 selectLevel2ById(Integer subcategoryId);

    int insertLevel2(CategoryLevel2 subcategory);

    int updateLevel2(CategoryLevel2 subcategory);

    int deleteLevel2(Integer subcategoryId);


    // 检查分类下是否有二级分类
    int countLevel2ByCategoryId(Integer categoryId);


    // 检查二级分类下是否有文件
    int countAudioBySubcategoryId(Integer subcategoryId);
}
